Skip to content

fix: sync hidden providers state with header totalRuns count#66

Open
NianJiuZst wants to merge 3 commits intopinchbench:mainfrom
NianJiuZst:fix/total-runs-filtered
Open

fix: sync hidden providers state with header totalRuns count#66
NianJiuZst wants to merge 3 commits intopinchbench:mainfrom
NianJiuZst:fix/total-runs-filtered

Conversation

@NianJiuZst
Copy link
Copy Markdown
Contributor

Bug

When a user hides a provider by clicking on the scatter graph's provider legend, the header's totalRuns count does not update to reflect the hidden entries.

Root Cause

hiddenProviders was managed as internal local state (useState) inside ScatterGraphs. When users toggled legend items:

  1. ScatterGraphs updated its own hiddenProviders state
  2. The chart's dots were hidden correctly
  3. But LeaderboardView's totalRuns was computed from filteredEntries, which had no knowledge of hiddenProviders
  4. Result: header showed stale run counts

Architecture (Before)

LeaderboardView
  └── ScatterGraphs (local hiddenProviders state)
         └── toggleProvider() → only updates ScatterGraphs internal state
  └── totalRuns = filteredEntries.reduce(...) ← never sees hiddenProviders

Fix

Split filtering into two layers:

Commit 1: fix(scatter-graphs): extract hiddenProviders to controlled props

Lift hiddenProviders state out of ScatterGraphs into LeaderboardView via controlled props.

Commit 2: fix(leaderboard-view): split business filters from legend-hidden providers

  • businessFilteredEntries: provider filter + open weights only. Used for totalRuns, legend provider list, and all charts/tables.
  • ScatterGraphs additionally applies hiddenProviders internally for chart rendering only.

Architecture (After)

LeaderboardView
  ├── hiddenProviders state (lifted here)
  ├── businessFilteredEntries = entries.filter(providerFilter + openWeights)
  │     └── totalRuns = businessFilteredEntries.reduce(...) ← stays in sync
  │     └── legend provider list (includes hidden providers)
  │     └── all charts/tables
  └── ScatterGraphs
        └── receives businessFilteredEntries + hiddenProviders
        └── hides dots based on hiddenProviders, but legend stays complete

Key insight: hiddenProviders only controls chart rendering in ScatterGraphs — it does NOT affect the legend's provider list or the header's totalRuns. Users can toggle providers back on/off from legend individually.

Files Changed

  • components/leaderboard-view.tsxhiddenProviders state + businessFilteredEntries memo
  • components/scatter-graphs.tsx — accepts hiddenProviders + onHiddenProvidersChange as props

Testing

  1. Open scatter graph view
  2. Note the totalRuns count in the header
  3. Click a provider in the scatter graph legend to hide it
  4. Verify totalRuns count does not change (the hidden entries are still counted in total runs)
  5. Verify the hidden provider still appears in the legend and can be clicked to restore
  6. Click "Show All" in legend → all providers restore

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 1, 2026

@NianJiuZst is attempting to deploy a commit to the Kilo Code Team on Vercel.

A member of the Team first needs to authorize it.

Move hiddenProviders state out of ScatterGraphs into LeaderboardView via
controlled props. This enables parent-level synchronization of legend
toggle state with header totalRuns.
…d state

Split filtering into two layers:
- businessFilteredEntries: provider filter + open weights (legend stays complete)
- scatterVisibleEntries: business filters + hiddenProviders (chart + header sync)

headerEntries selects scatterVisibleEntries only when in scatter graph view,
so totalRuns stays in sync with chart dots without affecting other sub-views.

Also prune hiddenProviders when business filters change to avoid stale entries.
@NianJiuZst NianJiuZst force-pushed the fix/total-runs-filtered branch from 7dc61fb to a921f9b Compare April 1, 2026 05:52
Copy link
Copy Markdown

@ScuttleBot ScuttleBot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScuttleBot review 🦀

Good state management fix. The bug was subtle: hiding a provider in the scatter chart legend didn't update the header's run count.

The problem:

  • hiddenProviders was local state inside ScatterGraphs
  • LeaderboardView computed totalRuns from filteredEntries — which had no visibility into what the chart was hiding
  • Counts went stale

The fix:

  • Lift hiddenProviders state to LeaderboardView
  • Split filtering: businessFilteredEntries (provider filter + open weights) stays for totalRuns/legend/tables
  • ScatterGraphs receives hiddenProviders as controlled props for chart-only rendering

Key insight I like: Hidden providers still appear in the legend (so users can toggle them back), and totalRuns correctly reflects the business filter, not the visual toggle. That's the right UX — "hide" means "hide from chart" not "remove from existence."

Clean separation of concerns. LGTM.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
leaderboard Ready Ready Preview, Comment Apr 7, 2026 2:15am

Request Review

@NianJiuZst
Copy link
Copy Markdown
Contributor Author

@olearycrew Hi! Could you please authorize the Vercel deployment for this PR when you get a chance? The changes are ready for review. Thanks so much! 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants